<template>
    <div>
        <el-card class="box-card">
            <div slot="header" class="clearfix">
                <h3 class="h3 font-border">个人中心</h3>
            </div>
            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="用户名称">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item label="手机号">
                    <el-input v-model="form.mobile"></el-input>
                </el-form-item>
                <el-form-item label="邮箱">
                    <el-input v-model="form.email"></el-input>
                </el-form-item>
                <el-form-item label="密码" type="password">
                    <el-input v-model="form.password"></el-input>
                </el-form-item>
            </el-form>
            <el-button type="success" @click="onSubmit">提交</el-button>
            <hd-wang-edit></hd-wang-edit>
        </el-card>
    </div>
</template>

<script>
export default {
    route: {name: 'index.profile', meta: 'auth'},
    data() {
        return {
            form: {}
        }
    },
    created() {
        if (this.$store.state.user.name) {
            this.form = this.$store.state.user;
        }
    },
    methods: {
        async onSubmit() {
            await this.axios.put('user/update', this.form)
            this.$router.push({name: 'index.index'})

        }
    }
}
</script>

<style scoped>

</style>
